br=input("Введите скобки:")
S1=[]
S2=[]
obr="()[]{}<>"
for i in br:
    if i not in obr:
        print("False")
        break
    if "(" in br:
        S1.append("(")
    if "[" in br:
        S1.append("[")
    if "{" in br:
        S1.append("{")
    if "<" in br:
        S1.append("<")
    if ")" in br:
        S2.append(")")
    if "]" in br:
        S2.append("]")
    if "}" in br:
        S2.append("}")
    if ">" in br:
        S2.append(">")
if len(S1)!=len(S2):
    print("False")
else:
    print("True")

    
